Skip to content

fix: set Content-Type only when request has body#93

Merged
mikolajbadyl merged 1 commit intomainfrom
fix/content-type-and-cleanup
Feb 28, 2026
Merged

fix: set Content-Type only when request has body#93
mikolajbadyl merged 1 commit intomainfrom
fix/content-type-and-cleanup

Conversation

@mikolajbadyl
Copy link
Member

  • `Content-Type: application/json` is no longer sent on GET/DELETE requests with no body
  • Removed always-true `m.testVars != nil` guard (map is always initialized before use)

@kilo-code-bot
Copy link

kilo-code-bot bot commented Feb 28, 2026

Code Review Summary

Status: 1 Warning Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
internal/cli/update_tests.go 268 Removing defensive nil check may cause panic
Files Reviewed (2 files)
  • internal/cli/update_tests.go - 1 issue
  • internal/core/tester/executor.go - No issues

Detailed Review

✅ executor.go:77-79 - Content-Type Fix (No Issues)

This is a correct fix. Setting Content-Type: application/json only when there's a request body is proper HTTP behavior. Previously, this header was incorrectly sent on GET/DELETE requests without a body.

⚠️ update_tests.go:268 - Defensive Nil Check Removal (WARNING)

The PR removes the if m.testVars != nil guard before calling extractVars(). While the PR description states this was an "always-true" guard, there are remaining nil checks in the same function:

  • Line 205: if m.testVars != nil
  • Line 235: if bs, ok := b.(string); ok && m.testVars != nil

These remaining checks suggest testVars can potentially be nil in certain scenarios. If extractVars() is called when testVars is nil, it will panic at lines 143-145 when trying to write to the nil map:

m.testVars[as] = v  // panic: assignment to entry in nil map

Recommendation: Either:

  1. Keep the nil check for defensive safety, or
  2. Document why the remaining nil checks (lines 205, 235) are still necessary while this one isn't

The executor.go change is correct and safe. The update_tests.go change appears safe under normal flow (since handleStartTestGroup initializes testVars before tests run), but removing defensive code always carries some risk.

@mikolajbadyl mikolajbadyl merged commit 9184523 into main Feb 28, 2026
1 check passed
@mikolajbadyl mikolajbadyl deleted the fix/content-type-and-cleanup branch February 28, 2026 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant